<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
	<display-name>Keter Web Project</display-name>

	<!-- =========context-param=========== -->
	<!-- 可以用于spring传递webapp.root变量 -->
	<context-param>
		<param-name>webAppRootKey</param-name>
		<param-value>webapp.root</param-value>
	</context-param>
	<!-- Main Spring context configuration file -->
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/conf/paper-context.xml</param-value>
	</context-param>
	<!-- logback配置 -->
	<context-param>
		<param-name>logbackConfigLocation</param-name>
		<param-value>/WEB-INF/conf/logback-web.xml</param-value>
	</context-param>
	<!-- Spring编码filter：fix error encoding in tomcat -->
	<filter>
		<filter-name>characterEncodingFilter</filter-name>
		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
		<init-param>
			<param-name>encoding</param-name>
			<param-value>UTF-8</param-value>
		</init-param>
		<init-param>
			<param-name>forceEncoding</param-name>
			<param-value>true</param-value>
		</init-param>
	</filter>
	<!-- Support for RESTfull HTTP methods -->
	<filter>
		<filter-name>HiddenHttpMethodFilter</filter-name>
		<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
	</filter>
	<!-- Spring security filters -->
	<filter>
		<filter-name>springSecurityFilterChain</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
	</filter>
	<!-- 防止视图中因session关闭导致懒加载失败(org.hibernate.LazyInitializationException) 使用留空的app-sevlet可以解决失效问题，原理不明！ -->
	<filter>
		<filter-name>openSessionInViewFilter</filter-name>
		<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
		<init-param>
			<param-name>sessionFactoryBeanName</param-name>
			<param-value>sessionFactory</param-value>
		</init-param>
		<init-param>
			<param-name>singleSession</param-name>
			<param-value>true</param-value>
		</init-param>
		<init-param>
			<param-name>flushMode</param-name>
			<param-value>AUTO</param-value>
		</init-param>
	</filter>
	<filter>
		<filter-name>sitemesh</filter-name>
		<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
	</filter>

	<!-- ========= filter-mapping =========== -->
	<filter-mapping>
		<filter-name>HiddenHttpMethodFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>characterEncodingFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>springSecurityFilterChain</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>openSessionInViewFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>sitemesh</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<!-- ========= listener =========== -->
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<listener>
		<!-- <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> -->
		<!-- 使用logback替代log4j -->
		<listener-class>ch.qos.logback.ext.spring.web.LogbackConfigListener</listener-class>
	</listener>

	<!-- ========= servlet =========== -->
	<!-- XSD Validate Error -->
	<!-- 配置spring核心servlet -->
	<servlet>
		<servlet-name>paper</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<!-- 显示提供配置文件位置：避免出现孤立的app-servlet.xml文件 -->
		 <init-param>
			<param-name>contextConfigLocation</param-name>
			<!-- <param-value>/WEB-INF/app-sevlet-empty.xml</param-value> -->
			<param-value>/WEB-INF/conf/paper-context.xml</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet>
		<servlet-name>DruidStatView</servlet-name>
		<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
	</servlet>

	<!-- ========= servlet mapping =========== -->
	<servlet-mapping>
		<servlet-name>DruidStatView</servlet-name>
		<url-pattern>/console/druid/*</url-pattern>
	</servlet-mapping>

	<!-- url配置为/，不带文件后缀，会造成其它静态文件(js，css等)不能访问。 如配为*.do，则不影响静态文件的访问 -->
	<servlet-mapping>
		<servlet-name>paper</servlet-name>
		<!-- 对*.jsp不起作用? -->
		<url-pattern>/</url-pattern>
	</servlet-mapping>

	<!-- ========= session-config =========== -->
	<session-config>
		<!-- 设置http-only属性，反XSS -->
		<!-- <cookie-config> <http-only>true</http-only> </cookie-config> -->
		<session-timeout>30</session-timeout>
	</session-config>

	<!-- ========= welcome-file-list =========== -->

	<!-- ========= error-page =========== -->
	<error-page>
		<error-code>404</error-code>
		<location>/framework/errors/404</location>
	</error-page>
	<error-page>
		<error-code>403</error-code>
		<location>/framework/errors/403</location>
	</error-page>
</web-app>